﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace QLNHK.GenKey
{
    public partial class frmMain : Form
    {
        public frmMain()
        {
            InitializeComponent();
        }

        private void frmMain_Load(object sender, EventArgs e)
        {
            UGMain.DataSource = ThongTinDonVi.SelectDynamic("1=1", "MaDonVi DESC").Tables[0];
        }

        private void btnThemThongTinDonVi_Click(object sender, EventArgs e)
        {
            frmThongTinDonVi f = new frmThongTinDonVi(Guid.Empty);
            f.ShowDialog();
            UGMain.DataSource = ThongTinDonVi.SelectDynamic("1=1", "MaDonVi DESC").Tables[0];
        }

        private void UGMain_DoubleClickRow(object sender, Infragistics.Win.UltraWinGrid.DoubleClickRowEventArgs e)
        {
            if (UGMain.ActiveRow != null)
            {
                frmThongTinDonVi f = new frmThongTinDonVi(new Guid(UGMain.ActiveRow.Cells["ID"].Value.ToString()));
                f.ShowDialog();
                UGMain.DataSource = ThongTinDonVi.SelectDynamic("1=1", "MaDonVi DESC").Tables[0];
            }
        }
    }
}
